import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex);
 
const store = new Vuex.Store({
    state: {
      user:{},
      picURL: '',
      artData:[],
    
    },
    mutations: {
      putUser(state,user) {
        state.user = []
       
          state.user = user
      ;
      },
      putPicurl(state,picURL) {
        state.picURL = picURL;
      },
    
      putArtdata(state,data){
        // 不能监听数组长度变化
        state.artData = [];

        data.forEach(element => {
            state.artData.push(element)
        });
        // console.log(state.artData);
      },
    }
  })

  export default store;